import request from '@/utils/request'
export const getRoleList = params => request({
  url: '/sys/role',
  params
})
export const addRole = data => request({
  url: '/sys/role',
  method: 'POST',
  data
})
export const getRole = id =>
  request({
    url: `/sys/role/${id}`
  })

// export function updataRole(id, data) {
//   return request({
//     method: 'PUT',
//     url: `/sys/role/${id}`,
//     data
//   })
// }
export function updataRole(data) {
  return request({
    method: 'PUT',
    url: `/sys/role/${data.id}`,
    data
  })
}
export function delRole(id) {
  return request({
    url: `/sys/role/${id}`,
    method: 'delete'
  })
}
// 给角色分配权限
export function assignPerm(data) {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}
